part of api;

extension Common on API {
  /// 通过 key 查询 redis 中的值
  Future<T?> getRedisValue<T>(String key) async {
    try {
      const path = "/common/redis/client/getStringVal";
      return await api.get<T?>(path, data: {"key": key}, needToast: false);
    } catch (e) {
      return null;
    }
  }

  Future<String?> smsCodeByEncrypt(String mobile) async {
    const path = "/common/common/rlapp-verhyc-codes";
    final encryptMobile = CacheUtil.niceDay(mobile);
    return await api.get(path, data: {"mobile": encryptMobile});
  }

}